/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package podologia.beansDB;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Hernan
 */
@Entity
@Table(name = "formulamagistral")
@NamedQueries({@NamedQuery(name = "Formulamagistral.findByIdFm", query = "SELECT f FROM Formulamagistral f WHERE f.idFm = :idFm"), @NamedQuery(name = "Formulamagistral.findByNombre", query = "SELECT f FROM Formulamagistral f WHERE f.nombre = :nombre"), @NamedQuery(name = "Formulamagistral.findByVtoMax", query = "SELECT f FROM Formulamagistral f WHERE f.vtoMax = :vtoMax"), @NamedQuery(name = "Formulamagistral.findByStockExistente", query = "SELECT f FROM Formulamagistral f WHERE f.stockExistente = :stockExistente"), @NamedQuery(name = "Formulamagistral.findByStockMin", query = "SELECT f FROM Formulamagistral f WHERE f.stockMin = :stockMin")})
public class Formulamagistral implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE)
    @Column(name = "idFm", nullable = false)
    private Integer idFm;
    @Column(name = "nombre")
    private String nombre;
    @Lob
    @Column(name = "descripcion")
    private String descripcion;
    @Lob
    @Column(name = "preparacion")
    private String preparacion;
    @Column(name = "vtoMax")
    private Integer vtoMax;
    @Column(name = "stockExistente")
    private Integer stockExistente;
    @Column(name = "stockMin")
    private Integer stockMin;
   
    @OneToMany(mappedBy = "idFm")
    private Collection<Fmelaboradas> fmelaboradasCollection;

    public Formulamagistral() {
    }

    public Formulamagistral(Integer idFm) {
        this.idFm = idFm;
    }

    public Integer getIdFm() {
        return idFm;
    }

    public void setIdFm(Integer idFm) {
        Integer oldIdFm = this.idFm;
        this.idFm = idFm;
        changeSupport.firePropertyChange("idFm", oldIdFm, idFm);
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        String oldNombre = this.nombre;
        this.nombre = nombre;
        changeSupport.firePropertyChange("nombre", oldNombre, nombre);
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        String oldDescripcion = this.descripcion;
        this.descripcion = descripcion;
        changeSupport.firePropertyChange("descripcion", oldDescripcion, descripcion);
    }

    public String getPreparacion() {
        return preparacion;
    }

    public void setPreparacion(String preparacion) {
        String oldPreparacion = this.preparacion;
        this.preparacion = preparacion;
        changeSupport.firePropertyChange("preparacion", oldPreparacion, preparacion);
    }

    public Integer getVtoMax() {
        return vtoMax;
    }

    public void setVtoMax(Integer vtoMax) {
        Integer oldVtoMax = this.vtoMax;
        this.vtoMax = vtoMax;
        changeSupport.firePropertyChange("vtoMax", oldVtoMax, vtoMax);
    }

    public Integer getStockExistente() {
        return stockExistente;
    }

    public void setStockExistente(Integer stockExistente) {
        Integer oldStockExistente = this.stockExistente;
        this.stockExistente = stockExistente;
        changeSupport.firePropertyChange("stockExistente", oldStockExistente, stockExistente);
    }

    public Integer getStockMin() {
        return stockMin;
    }

    public void setStockMin(Integer stockMin) {
        Integer oldStockMin = this.stockMin;
        this.stockMin = stockMin;
        changeSupport.firePropertyChange("stockMin", oldStockMin, stockMin);
    }

    

    public Collection<Fmelaboradas> getFmelaboradasCollection() {
        return fmelaboradasCollection;
    }

    public void setFmelaboradasCollection(Collection<Fmelaboradas> fmelaboradasCollection) {
        this.fmelaboradasCollection = fmelaboradasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFm != null ? idFm.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Formulamagistral)) {
            return false;
        }
        Formulamagistral other = (Formulamagistral) object;
        if ((this.idFm == null && other.idFm != null) || (this.idFm != null && !this.idFm.equals(other.idFm))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nombre;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
